Texture Mapping
Texture mapping is a commonly employed technique for adding detail in computer graphics rendering to achieve a high degree of realism in the rendered image. Each drawing primitive (i.e. each polygon) is specified with texture coordinates at its vertices which describe corresponding locations within an array of memory locations in a memory storage device, referred to as a texture. As the primitive is rasterized pixel-by-pixel, the texture coordinates are interpolated to arrive at a corresponding texel address within the texture.
The contents of the texture at the interpolated address are fetched from the memory device and are used to affect the color of the pixel value stored in the frame buffer. There are a number of ways that a texel value can affect the color of the pixel stored in the frame buffer. In most cases, the texel value is used to either modulate or replace a luminance or color value interpolated between color or luminance values specified or computed at the vertices of the drawing primitive.
Alpha Blending
In computer graphics and image processing, it often is necessary to combine color values from separate sources into a composite color value. It is a standard practice in the field of computer graphics to represent an image as a set pixels each of which has four distinct values: Red, Green, Blue, and Alpha. Red, Green and Blue are additive primary components in the RGB color space. The alpha channel contains information used to weight the Red, Green, and Blue values when combining them with colors from other sources. Also, the alpha channel is often used to represent the opacity of a material or the amount of pixel area covered by a polygon.
When a translucent or partially covered pixel is to be written to a location in the frame buffer, the incoming value may be combined with the value already stored at the location and the resulting composite color may be stored in the location. The alpha values are used to weight the contribution of the source (incoming) value with the destination (current) value in proportion to each value's opacity or area. Various operating standards, such as Open GL and Direct 3D, allow applications to specify conditions based upon the alpha value of an incoming pixel where a pixel write can be avoided (for example, when Alpha is equal to or nearly zero and the incoming pixel would have little or no effect).
Computation of Alpha From Depth Texture Comparison
A procedure in which depth values are compared against a texture coordinate is disclosed in "Fast Shadows and Lighting Effects Using Texture Mapping", Computer Graphics (SIGGRAPH 1992 Proceedings), Vol. 26, No. 2, July 1992, pages 249-252, by M. Segal, C. Korobkin, R. van WidenFelt, J. Foran, and P. Haeberli. More specifically, this paper details a technique where four depth values fetched from a texture map are compared against a third texture coordinate which is interpolated between values specified at the vertices of the drawing primitive. If the depth texel's value is equal to or greater than the value of the third texture coordinate, then the texels value is replaced with a value of 1.0 otherwise the value is replaced with a value of 0.0. The resulting four texel values are then bilinearly interpolated to arrive at a single value between 0.0 and 1.0 which replaces the incoming pixel fragment's alpha value. Thus the fragment color interpolated between values specified at the vertices is attenuated by the alpha value before it is stored in the frame buffer.